package cn.linjianhui.flink.sample.web.model;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;

@Getter
@Setter
@AllArgsConstructor
public class DataModel {
    private BigDecimal totalPayAmount;
    private long totalPayNumber;
    private long totalQty;

    public void addPayAmount(BigDecimal amount) {
        this.totalPayAmount = this.totalPayAmount.add(amount);
    }

    public void addPayNumber(long number){
        this.totalPayNumber += number;
    }

    public void addQty(long qty) {
        this.totalQty += qty;
    }

    public double getTotalPayAmount() {
        return totalPayAmount.setScale(4, BigDecimal.ROUND_HALF_EVEN).doubleValue();
    }
}
